﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;

namespace homework8
{
    class Search
    {
        public Task<string> GetSearch(string url)
        {
            return Task<string>.Run(() =>
            {
                return DownloadUrl(url).Substring(0, 200);
            });
        }
        public string DownloadUrl(string url)
        {
            WebClient webclient = new WebClient();
            webclient.Credentials = CredentialCache.DefaultCredentials;
            byte[] data = webclient.DownloadData(url);
            return Encoding.Default.GetString(data);
        }
    }
}
